/**
 * Created by liebling on 2017/7/1.
 */
var keystone = require('keystone');
var _ = require('lodash');

exports = module.exports = function (req, res) {
	var view = new keystone.View(req, res);
	var locals = res.locals;
	var pathArr = _.compact(req.route.path.replace(/.html/,'').split('/'));
	// locals.section is used to set the currently selected
	// item in the header navigation.
	locals.section = pathArr[0];
	locals.pageName = pathArr.join('/');

	// Render the view
	view.render(pathArr.join('/'));
};
